package com.moyu.shopapp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.moyu.shopapp.entity.Cart;
import com.moyu.shopapp.entity.Goods;
import com.moyu.shopapp.entity.vo.CartGoodsVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author ZJF
 * @description 针对表【cart】的数据库操作Mapper
 * @createDate 2023-12-01 16:38:29
 * @Entity com.moyu.shopapp.entity.Cart
 */
@Mapper
public interface CartMapper extends BaseMapper<Cart> {
    @Select("SELECT * FROM goods JOIN cart ON cart.goods_id=goods.goods_id WHERE user_id=#{userId}")
    List<CartGoodsVO> selectAllByUserId(int userId);
}
